<template>
	<view>
		<uni-card style="width: 100%;height: 100%; margin: 0 auto;margin-top: 10px;">
			<uni-forms ref="baseForm"  style="width: 90%;height: 1450rpx;">
				<uni-forms-item label="日程标题" required>
					<uni-easyinput :value="rcInfo.schedulename"  color="#000"/>
				</uni-forms-item>
				<uni-forms-item label="开始时间">
					<uni-easyinput :value="formatdate(rcInfo.starttime)"  color="#000"/>
				</uni-forms-item>
				<uni-forms-item label="结束时间">
					<uni-easyinput :value="formatdate(rcInfo.overtime)"  color="#000"/>
				</uni-forms-item>

				<uni-forms-item label="紧急程度" required>
					<uni-easyinput :value="rcInfo.urgency"  color="#000"/>
				</uni-forms-item>
				<uni-forms-item label="日程提醒" required>
					<!-- <u-switch v-model="value" :value="rcInfo.urgency == 1 ? 'true':'false' " @change="change"></u-switch> -->
					<uni-easyinput :value="rcInfo.remind=='true'?'提醒':'不提醒' "  color="#000"/>
				</uni-forms-item>

				<uni-forms-item label="日程描述">
					<uni-easyinput type="textarea" :value="rcInfo.describe"  />
				</uni-forms-item>
				<u-button text="删除日程" @click="rcdelete(rcInfo.sid)" color="linear-gradient(to right, rgb(217, 25, 28), rgb(255, 252, 220))">
				</u-button>
			</uni-forms>

		</uni-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sid: '',
				rcInfo: [],
				value:false,
			}
		},
		onShow() {
			this.findRC();
		},
		onLoad(res) {
			this.sid = res.sid;
			this.findRC();
		},
		methods: {
			rcdelete(sid){
				uni.request({
					url:'http://localhost:9525/fragmentary/rcdelete?sid='+sid,
					method: 'POST',
					success: (res) => {
						uni.showToast({
							title: "删除成功"
						});
						
					}
				})
				// uni.switchTab({
				// 	url:'./Richengindex'
				// })
				// this.aa();
			},
			aa(){
				uni.navigateTo({
					url:'./Richengindex'
				})
			},
			formatdate(date){
				const dateTime = new Date(date)
				const YY = dateTime.getFullYear()
				const MM =
				    dateTime.getMonth() + 1 < 10 ? '0' + (dateTime.getMonth() + 1) : dateTime.getMonth() + 1
				const DD =
				    dateTime.getDate() < 10 ? '0' + dateTime.getDate() : dateTime.getDate()
				// const hh =
				//     dateTime.getHours() < 10 ? '0' + dateTime.getHours() : dateTime.getHours()
				// const mm =
				//     dateTime.getMinutes() < 10 ? '0' + dateTime.getMinutes() : dateTime.getMinutes()
				// const ss =
				//     dateTime.getSeconds() < 10 ? '0' + dateTime.getSeconds() : dateTime.getSeconds()
				return `${YY}-${MM}-${DD}`
			},
			findRC() {
				uni.request({
					url: 'http://localhost:9525/fragmentary/findRC?sid=' + this.sid,
					method: 'post',
					success: (res) => {
						console.log(res.data)
						this.rcInfo = res.data
					}
				})
			}
		}
	}
</script>

<style>

</style>
